<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="template-head.jsp" />
<jsp:include page="template-body.jsp"/>
<div class="container">
	<jsp:include page="errors.jsp"/>
<div id="researcherpage">
	<h1> Welcome to IMS !</h1>
	<div id="researcherpagebody">
	<div class="row"> 
		<form id="researcherform" method="post" action="researcher.do">
			<div class = "span4">
			<div  class = "hero-unit" style="background-color:#888;border:none;text-align:center">
			<h4 > Creating a good survey</h4>
			</div>
			<div class="hero-unit">			
			<span class="badge"></span><br/><br/><br/>
			<span class="badge"></span><br/><br/><br/>
			<span class="badge"></span><br/><br/><br/>
			<span class="badge"></span><br/><br/><br/>
			<span class="badge"></span><br/><br/><br/>
			<span class="badge"></span><br/><br/><br/>
			</div>
			<div>
				<a href="#myModal" class="btn btn-primary" data-toggle="modal" data-backdrop="true" >Create New Survey</a>
			</div>
			</div>
			<div class ="span4">
			<div class="hero-unit" style="background-color:#888;border:none;text-align:center">
			<h4> Your created Survey</h4>
			</div>
			<div class="hero-unit">	
			<c:choose>
			<c:when test="${user.type==2 }">	
			<c:if test="${!(empty survey_list)}">
			<%int i = 1,g=0;%>
			  <c:forEach var="survey" items="${survey_list}">	
			  <span class="badge badge-success"><%=i%></span><font face="verdana" color="green"> <a href="surveysummary.do?value=${survey.sid}&button=View">${survey.title}</a></font><br/><br/><br/>
			  <%i++;%>
			  <%if(i==7){
				 break;
			  } %>
			  </c:forEach>
			<% g = 6-i;%>
			<% if(g>0){
			   for(int k=0;k<g+1;k++){%>
				<span class="badge badge-success"><%=i+k%></span><br/><br/><br/>	
			<% }}%>
			</c:if>
			<c:if test="${(empty survey_list)}">
			<span class="badge badge-success"></span><br/><br/><br/>
			<span class="badge badge-success"></span><br/><br/><br/>
			<span class="badge badge-success"></span><br/><br/><br/>
			<span class="badge badge-success"></span><br/><br/><br/>
			<span class="badge badge-success"></span><br/><br/><br/>
			<span class="badge badge-success"></span><br/><br/><br/>
			</c:if>
			</c:when>
			</c:choose>
			</div>
			<div id="researcherviewbutton">
				<input type="submit" name="button" class="btn btn-success" data-toggle="button" value="View List of Surveys"/>
			</div>
			</div>
			<div class="span4"> 
			<div class="hero-unit" style="background-color:#888;border:none;text-align:center">
			<h4> Your Mailing List </h4>
			</div>
			<div class="hero-unit">			
			<c:choose>
			<c:when test="${user.type==2 }">	
			<c:if test="${!empty(email_list)}">
			<%int i = 1,g=0;%>
			  <c:forEach var="email" items="${email_list}">	
			  <span class="badge badge-warning"><%=i%></span><font face="verdana" color="orange"> <a href="mailinglist.do?value=${email.name}&button=View">${email.name}</a></font><br/><br/><br/>
			  <%i++;%>
			  <%if(i==7){
			   break ;} %>
			  </c:forEach>
			<% g = 6-i;%>
			<% if(g>0){
			   for(int k=0;k<g+1;k++){%>
				<span class="badge badge-warning"><%=i+k%></span><br/><br/><br/>	
			<% }}%>
			</c:if>
			<c:if test="${empty(email_list)}">
			<span class="badge badge-warning"></span><br/><br/><br/>
			<span class="badge badge-warning"></span><br/><br/><br/>
			<span class="badge badge-warning"></span><br/><br/><br/>
			<span class="badge badge-warning"></span><br/><br/><br/>
			<span class="badge badge-warning"></span><br/><br/><br/>
			<span class="badge badge-warning"></span><br/><br/><br/>
			</c:if>
			</c:when>
			</c:choose>
			</div>
			<div id="researchergeneratebutton">
			 <input type="submit" name="button" class="btn btn-warning" data-toggle="button" value="Mailing Lists"/>
			</div>
			</div> 
			</form>
			</div>
			<!-- <div class="popover">
			<a href="#myPopover" class="btn btn-danger" rel="popover" title="A Title" data-content="And here's some amazing content. It's very engaging. right?">hover for popover</a> 
			</div> -->
	</div>

				<%--  <a href="#myPopover" class="btn btn-danger" rel="popover" title="A Title" data-content="And here's some amazing content. It's very engaging. right?">hover for popover</a> 
	--%>
	<!--Create another space for contents' extension  -->
</div>
</div>
<jsp:include page="surveytitle.jsp"/>
<jsp:include page="template-foot.jsp" /> 